<?php
include_once(ABSPATH . '../bad_ips.php');
if (!empty($badIps)) {
	$ip = User_Session::getIP();
	foreach ($badIps as $badIp) {
		if($ip == $badIp) exit();
	}
}

if (isset($_SERVER['REMOTE_ADDR'])) {
	User_Session::insertNewTreatment();
	$treatmentsAmount = User_Session::getTreatmentsAmountByIp(15);
	$treatmentsAmount2 = User_Session::getTreatmentsAmountByIp(60);
	if($treatmentsAmount  > 10 || $treatmentsAmount2 > 35) { 
		if($treatmentsAmount > 20 || $treatmentsAmount2 > 50) {
			User_Session::addToBadIp($ip);
	  }
	  echo 'Слишком много запросов с вашего IP';
	  exit();
	}
}
?>